var config = require('../../../../../config');
var mongoose = require('../../../../../framework/mongoose');

var pictureSchema = new mongoose.Schema({
    title: String,
    descr: String,
    url: String,
    gallery: { type: mongoose.Schema.Types.ObjectId, ref: 'cms_gallery' }
}, config.schemaOptions);
pictureSchema.virtual('id').get(function() {
    return this._id;
});
exports.CmsGalleryPicture = mongoose.model('cms_gallery_picture', pictureSchema);

var gallerySchema = new mongoose.Schema({
    name: String,
    descr: String,

    order: String,
    status: Number,

    createTime: Date,
    updateTime: Date,
    subscription: { type: mongoose.Schema.Types.ObjectId, ref: 'app_subscription' },
    pictures : [{ type: mongoose.Schema.Types.ObjectId, ref: 'cms_gallery_picture' }]
}, config.schemaOptions);
gallerySchema.virtual('id').get(function() {
    return this._id;
});
exports.CmsGallery = mongoose.model('cms_gallery', gallerySchema);



